import { App, Component, DefineComponent } from "vue";

export interface obj {
  [k: string]: any;
}
export type fun = (...arg: any) => any;

interface ComponentInstall<T> extends obj {
  install: (app: App<T>) => App<T>;
  name: string;
}

export function getExpComponent<T>(component: Component<T>, componentName: string) {
  const p: any = component;
  p.name = componentName;
  if (!(p.install instanceof Function)) {
    p.install = (app: App) => { return app.component(componentName, component); };
  }
  return p as DefineComponent<{}, T> & ComponentInstall<T>;
}

export interface TitleContent {
  title: string;
  content: string;
}
